package com.rcloud.server.sealtalk.dao;

import com.rcloud.server.sealtalk.domain.GroupMembers;
import com.rcloud.server.sealtalk.model.dto.GroupMemberOptDto;
import com.rcloud.server.sealtalk.model.dto.MemberDTO;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface GroupMembersMapper extends Mapper<GroupMembers> {

    List<GroupMembers> queryGroupMembersWithGroupByMemberId(@Param("memberId") Integer memberId);

    List<GroupMembers> queryGroupMembersWithUsersByGroupId(@Param("groupId") Integer groupId,@Param("isDeleted") Integer isDeleted);

    /**
     * 查询群组成员列表
     * @param groupId
     * @return
     */
    List<GroupMemberOptDto> queryGroupMembersWithUsersByGroupIdOptimize(@Param("groupId") Integer groupId, @Param("memberId") Integer currentUserId);

    GroupMembers queryGroupMembersWithGroupByGroupIdAndMemberId(@Param("groupId") Integer groupId, @Param("memberId") Integer memberId);

    List<GroupMembers> selectGroupMembersWithUsersByGroupIdsAndVersion(@Param("groupIdList") List<Integer> groupIdList, @Param("version") Long version);

    int insertBatch(@Param("groupMemberList") List<GroupMembers > groupMemberList);

    /**
     * 查询群成员列表（查询出所有管理人员和当前自己的数据后限制200条）
     * @param groupId
     * @param currentUserId
     * @return
     */
    List<GroupMembers> getGroupMembersSpecial(@Param("groupId") Integer groupId, @Param("currentUserId") Integer currentUserId);

    /**
     * 查询群成员列表-可分页
     * @param groupId
     * @return
     */
    List<GroupMembers> getGroupMembersPage(@Param("groupId") Integer groupId);

    /**
     * 群成员列表-可根据群成员昵称查询
     * @param groupId
     * @param nickname
     * @return
     */
    List<GroupMembers> getGroupMembersSearch(@Param("groupId") Integer groupId, @Param("nickname") String nickname);
}